package ofpof.service.timers;

import java.util.Date;

import ofpof.domain.dao.CaptchaDao;

import org.springframework.beans.factory.annotation.Autowired;

public class CaptchaExpiryJob {
	
	private long captchaExpiryTimeout;
	
	@Autowired
	private CaptchaDao captchaDao;
	
	public void expire() {
		Date boundaryDate = new Date(new Date().getTime()-captchaExpiryTimeout);
		captchaDao.deleteOlderThan(boundaryDate);
	}

	public void setCaptchaExpiryTimeout(long captchaExpiryTimeout) {
		this.captchaExpiryTimeout = captchaExpiryTimeout;
	}
}
